﻿@page
@{ Layout = "_Layout"; }

<div style="padding:0 8px;">
    <el-form :inline="true" :size="euiSize">
        <el-form-item label="关键字">
            <el-input v-model="form.keyWords" placeholder="组织、用户名、姓名" prefix-icon="el-icon-search" clearable></el-input>
        </el-form-item>
        <el-form-item label="状态">
            <el-select v-model="form.state" placeholder="" v-on:change="btnUserSearchClick" clearable>
                <el-option label="全部状态" value=""></el-option>
                <el-option label="未开始" value="Weikaishi"></el-option>
                <el-option label="学习中" value="Xuexizhong"></el-option>
                <el-option label="已完成" value="Yiwancheng"></el-option>
            </el-select>
        </el-form-item>
        <el-form-item>
            <el-button :size="euiSize" icon="el-icon-search" type="primary" v-on:click="btnUserSearchClick">查 询</el-button>
            <el-button :size="euiSize" plain type="primary" icon="el-icon-download" v-on:click="btnUserExportClick">
                导 出
            </el-button>
            <el-button v-if="course.offLine && userTotal>0" :size="euiSize" icon="el-icon-setting" type="warning" v-on:click="btnOfflineSetClick">批量上课</el-button>
            <el-button v-if="course.offLine && userTotal>0" :size="euiSize" icon="el-icon-setting" type="warning" v-on:click="btnOfflineOverClick">批量完成</el-button>
        </el-form-item>
    </el-form>
    <el-table ref="userTable" :data="userList" :size="euiSize" v-on:selection-change="userHandleSelectionChange"
              style="width: 100%">
        <el-table-column type="selection"
                         width="28">
        </el-table-column>
        <el-table-column label="#"
                         type="index"
                         width="60"
                         align="left">
            <template scope="scope">
                <span>{{(form.pageIndex - 1) * form.pageSize + scope.$index + 1}}</span>
            </template>
        </el-table-column>
        <el-table-column label="账号">
            <template slot-scope="scope">
                <el-link :underline="false" type="primary" v-on:click="btnViewClick(scope.row.user.id)">{{scope.row.user.userName}}</el-link>
            </template>
        </el-table-column>
        <el-table-column prop="user.displayName" label="姓名">
        </el-table-column>
        <el-table-column prop="user.organNames" label="组织" show-overflow-toolti>
        </el-table-column>
        <el-table-column prop="credit" label="学分">
        </el-table-column>
        <el-table-column label="学时">
            <template slot-scope="scope">
                {{ utils.formatDuration(scope.row.totalDuration) }}/{{ utils.formatDuration(course.duration) }}
            </template>
        </el-table-column>
        <el-table-column prop="maxScore" label="成绩" width="100">
        </el-table-column>
        <el-table-column label="评价" width="100">
            <template slot-scope="scope">
                {{ scope.row.avgEvaluation}}
                <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" class="bi bi-star-fill text-warning" viewBox="0 0 16 16">
                    <path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"></path>
                </svg>
            </template>
        </el-table-column>
        <el-table-column prop="stateStr" label="状态" width="100">
        </el-table-column>
        <el-table-column label="上课状态" v-if="course.offLine">
            <template slot-scope="scope">
                <el-tag type="success" v-if="scope.row.isSignin" size="mini">已上课</el-tag>
                <el-tag type="warning" v-else size="mini">未上课</el-tag>
            </template>
        </el-table-column>
        <el-table-column prop="overStudyDateTime" label="完成时间" width="140">
        </el-table-column>
        @await Html.PartialAsync("_PartialTableEmpty")
    </el-table>

    <div style="text-align: center; margin-top: 10px;">
        <el-pagination v-on:current-change="userHandleCurrentChange" background
                       :current-page="form.pageIndex"
                       :page-size="form.pageSize"
                       layout="total, prev, pager, next"
                       :total="userTotal">
        </el-pagination>
    </div>
</div>

@section Scripts{
    <script src="/sitefiles/assets/js/admin/study/studyCourseManagerUser.js" type="text/javascript"></script>
}